/*    */ package com.bj58.analysis.tools;
/*    */ 
/*    */ import com.bj58.analysis.tools.common.bean.LogBean;
/*    */ import java.util.HashMap;
/*    */ import java.util.Map;
/*    */ import net.sf.json.JSONObject;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public class CommonAnalysisToolsDriver
/*    */ {
/* 17 */   private static Map<LogToolsTag, CommonAnalysis> maps = null;
/*    */   
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */   public static String parserToJoson(String logLine, LogToolsTag toolTag)
/*    */     throws ClassNotFoundException, InstantiationException, IllegalAccessException
/*    */   {
/* 33 */     if (maps == null) {
/* 34 */       maps = new HashMap();
/*    */     }
/* 36 */     String log = null;
/* 37 */     String flag = toolTag.getTag();
/* 38 */     CommonAnalysis tool = (CommonAnalysis)maps.get(toolTag);
/* 39 */     if (tool == null) {
/* 40 */       Class<?> claz = Class.forName(flag);
/* 41 */       tool = (CommonAnalysis)claz.newInstance();
/* 42 */       maps.put(toolTag, tool);
/*    */     }
/*    */     
/* 45 */     LogBean bean = tool.analysis(logLine);
/* 46 */     if (bean != null) {
/* 47 */       log = JSONObject.fromObject(bean).toString();
/*    */     }
/* 49 */     return log;
/*    */   }
/*    */   
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */   public static LogBean parserToInstance(String logLine, LogToolsTag toolTag)
/*    */     throws ClassNotFoundException, InstantiationException, IllegalAccessException
/*    */   {
/* 66 */     if (maps == null) {
/* 67 */       maps = new HashMap();
/*    */     }
/* 69 */     String flag = toolTag.getTag();
/* 70 */     CommonAnalysis tool = (CommonAnalysis)maps.get(toolTag);
/* 71 */     if (tool == null) {
/* 72 */       Class<?> claz = Class.forName(flag);
/* 73 */       tool = (CommonAnalysis)claz.newInstance();
/* 74 */       maps.put(toolTag, tool);
/*    */     }
/*    */     
/* 77 */     return tool.analysis(logLine);
/*    */   }
/*    */ }


/* Location:              C:\Users\zhaoxiang\Desktop\basestat_log_common_tools-0.3.jar!\com\bj58\analysis\tools\CommonAnalysisToolsDriver.class
 * Java compiler version: 5 (49.0)
 * JD-Core Version:       0.7.1
 */